<?php

class xmlconvert_app{
	function convertArray($array,$root="<root/>"){
		return $this->assocArrayToXML("respuesta",$array);
	}
	
	
	function assocArrayToXML($root_element_name,$ar) 
{ 
    $xml = new SimpleXMLElement("<?xml version=\"1.0\"?><{$root_element_name}></{$root_element_name}>"); 
    $f = create_function('$f,$c,$a',' 
            foreach($a as $k=>$v) { 
                if(is_array($v)) { 
                    $ch=$c->addChild($k); 
                    $f($f,$ch,$v); 
                } else {
                	global $core;
					$lexicon=$core->getLexicon();
					$v=$lexicon->traduce($v); 
                    $c->addChild($k,$v); 
                } 
            }'); 
    $f($f,$xml,$ar); 
    return $xml; 
} 
	
	
	
}
